<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/WEB-INF/tld/extend.tld" prefix="extend"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	
	<head>		
		<title>乐盈培训网 - 公开课程</title>
		<link href="<extend:contextPath name="contextPath"/>/css/style.css" rel="stylesheet" type="text/css" />
		
		<script language="JavaScript" src="/qiyexuexi/scripts/jquery.js"></script>
		<script>		
		function go(month, location, category, page)
		{
			var url = '<extend:contextPath name="contextPath"/>/course/publicCourse.do?method=gotoPublicCourse&year=2010';
			
			if(month != 'all')
			{
				if(month!=null && month!='')
				{
					url = url + '&month=' + month;					 
				}else if ($("[name=month]")[0].value!=null && $("[name=month]")[0].value!='')
				{
					url = url + '&month=' + $("[name=month]")[0].value;	
				}
			}
			
			if(location != 'all')
			{
				if(location != null && location != '')
				{
					url = url + '&location=' + location;
				} else if ($("[name=location]")[0].value!=null && $("[name=location]")[0].value!='')
				{
					url = url + '&location=' + $("[name=location]")[0].value;
				}
			}	
			
			if(category != 'all')
			{
				if (category != null && category != '')
				{
					url = url + '&category=' + category;
				}else if ($("[name=category]")[0].value!=null && $("[name=category]")[0].value!='')
				{
					url = url + '&category=' + $("[name=category]")[0].value;
				}
			}
			
			if(page != '')
			{
				url = url + '&page=' + page;
			}
			url = encodeURI(url);
  			url = encodeURI(url);
			window.location = url;
		}
		
		function resubmit(i)
		{
			var month = $("[name=month]")[0].value;
			var location = $("[name=location]")[0].value;
			var category = $("[name=category]")[0].value;
			
			go(month, location, category, i);
		}
		</script>
	</head>		
	
	<body>
				
		<div style="position:absolute; height:100%; width:1045px;">
							
			<jsp:include page="header.jsp"></jsp:include>
			
			<div id="publicCourse" style="float:left; width:730px; height:800px; margin-top:5px; border: #D9D9D9 1px solid;">
				
				<table width="100%" cellpadding="0" cellspacing="0" style="margin-top:5px; margin-left:15px;">
					<tr>
						<td colspan="10" height="30px">
							<font style="color:#41519A; size:15px;"><b>公开课程</b></font>
						</td>
					</tr>
					<tr>
						<td style="width:100%; font-size:12px; height:24; line-height:25px">
							2010课程导航:&nbsp;
							<c:choose>
								<c:when test="${month != null}">
									<a class="normal_link" href="javascript:go('all', '', '', '')">所有日期</a> 
								</c:when>
								<c:otherwise>
									<a class="normal_link" href="javascript:go('all', '', '', '')"><font color="red">所有日期</font></a>
								</c:otherwise>
							</c:choose>
							&nbsp;
							<c:forEach var="x" begin="1" end="12" step="1">
								<c:choose>
									<c:when test="${x == month}">
										<a class="normal_link" href="javascript:go('<c:out value="${x}" />', '', '', '')">
											<font color="red"><c:out value="${x}" />月</font>
										</a>
									</c:when>
									<c:otherwise>
										<a class="normal_link" href="javascript:go('<c:out value="${x}" />', '', '', '')"><c:out value="${x}" />月</a>
									</c:otherwise>
								</c:choose>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<td style="width:100%; font-size:12px; height:24; line-height:25px">
							区域课程导航:&nbsp;&nbsp;
							<c:choose>
								<c:when test="${location != null}">
									<a class="normal_link" href="javascript:go('', 'all', '', '')">所有区域</a> 
								</c:when>
								<c:otherwise>
									<a class="normal_link" href="javascript:go('', 'all', '', '')"><font color="red">所有区域</font></a> 
								</c:otherwise>
							</c:choose>
							&nbsp;
							<c:forEach var="city" items="${courseCities}">
								<c:choose>
									<c:when test="${city == location}">
										<a class="normal_link" href="javascript:go('', '<c:out value="${city}" />', '', '')">
											<font color="red"><c:out value="${city}" /></font>
										</a> 
									</c:when>
									<c:otherwise>
										<a class="normal_link" href="javascript:go('', '<c:out value="${city}" />', '', '')"><c:out value="${city}" /></a> 
									</c:otherwise>
								</c:choose>
							</c:forEach>						
						</td>
					</tr>
					<tr>
						<td style="width:100%; font-size:12px; height:24; line-height:25px">
							课程类别导航:&nbsp;&nbsp;
							<c:choose>
								<c:when test="${category != null}">
									<a class="normal_link" href="javascript:go('', '', 'all', '')">所有类别</a>
								</c:when>
								<c:otherwise>
									<a class="normal_link" href="javascript:go('', '', 'all', '')"><font color="red">所有类别</font></a>
								</c:otherwise>
							</c:choose>
							 &nbsp;
							<c:forEach items="${courseCategory}" var="item">
								<c:choose>
									<c:when test="${item == category}">
										<a class="normal_link" href="javascript:go('', '', '<c:out value="${item}" />', '')">
											<font color="red"><c:out value="${item}" /></font>
										</a> 
									</c:when>
									<c:otherwise>
										<a class="normal_link" href="javascript:go('', '', '<c:out value="${item}" />', '')"><c:out value="${item}" /></a> 
									</c:otherwise>
								</c:choose>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<td style="width:100%; font-size:12px; height:24; line-height:25px">
							该类别课程共计：<c:out value="${totalCount}" />条
						</td>
					</tr>
				</table>
				
				<table width="100%" cellpadding="0" cellspacing="0" style="font-size:13px;">
					<tr>
						<td height="5"></td>
					</tr>
					<tr>
						<td height="28" bgcolor="#3399cc" align="center" width="73">
							<font color="#ffffff"><b>地区</b></font>
						</td>
						<td bgcolor="#3399cc" width="289">
							<font color="#ffffff"><b>培训课程</b></font>
						</td>
						<td bgcolor="#3399cc" width="100">
							<font color="#ffffff"><b>课程分类</b></font>
						</td>
						<td bgcolor="#3399cc" width="75">
							<font color="#ffffff"><b>开始日期</b></font>
						</td>
						<td bgcolor="#3399cc" width="75" align="center">
							<font color="#ffffff"><b>价格</b></font>
						</td>
						<td bgcolor="#3399cc" width="75">
							<font color="#ffffff"><b>人气</b></font>
						</td>
					</tr>
					
					<c:forEach items="${publicCourse}" var="course" varStatus="status">
						<c:if test="${status.index%2 == 0}">
    						<tr>
    					</c:if>
    					<c:if test="${status.index%2 == 1}">
    						<tr bgcolor="#f2f9ff">
    					</c:if>  
							<td height="28" align="center" width="73">
								<c:out value="${course.courseCity}"/>
							</td>
							<td>
								<a target="_blank" class="normal_link" href="<extend:contextPath name='contextPath'/>/course/viewCourseDetail.do?method=viewCourseDetail&courseId=<c:out value="${course.courseId}"/>">
									<c:out value="${course.courseTitle}"/>
								</a>
							</td>
							<td width="100">
								<c:out value="${course.courseCategory}"/>
							</td>
							<td width="75">
								<c:out value="${course.courseStartTimeAsStr}"/>
							</td>
							<td width="75" align="center">
								<c:out value="${course.coursePrice}"/>
							</td>
							<td width="75">
								人气
							</td>
						</tr>
					</c:forEach>
					
					<tr>
						<td height="20"></td>
					</tr>
					<tr>
						<td colspan="10" align="center" width="100%">
						<extend:paginationNav currentPage="${paginationSortOrderData.currentPage}" pageSize="${paginationSortOrderData.pageSize}" totalCount="${totalCount}"/>						
					</td> 
				</tr>
				</table>
			</div>
			
			<div class="course_det_hot_course">
				<table cellpadding="0" cellspacing="0" style="padding-top:0px;">
					<tr>
						<td height="28" align="left" style="padding-left:8px; font-size:13px;">
								<font style="size:12px; color:E56213"><b>热门培训课程</b></font>
						</td>
					</tr>							
					<tr>
						<td>
							<ul style="font-size:13px;margin:0px; padding:5px 0px 0px 8px; list-style:none outside none">
								<c:forEach items="${hotCourse}" var="item">
									<li style="height:21px;">·
										<a class="normal_link" target="_blank" 
											href="<extend:contextPath name='contextPath'/>/course/viewCourseDetail.do?method=viewCourseDetail&courseId=<c:out value="${item.courseId}"/>">
											<c:out value="${item.courseTitle}"/>
										</a>
									</li>											
								</c:forEach>																												
							</ul>
						</td>
					</tr>												
				</table>
			</div>
			
			<table width="100%">
					<tr><td height="10"></td></tr>
			</table>
			<table width="100%">
					<tr><td height="1" bgcolor="red"></td></tr>
			</table>
			
			
		</div>
			
			<html:form action="/forHiddenCriteria.do">
				<html:hidden property="month"/>
				<html:hidden property="location"/>
				<html:hidden property="category"/>
			</html:form>
</html>



					<%-- local storage test part --%>
					
					<script>
						alert(localStorage.getItem("key"));
					</script>
					
					<%-- local storage test part --%>